package com.njbdqn.myshops.model.service;

import com.njbdqn.myshops.model.mapper.OrdersMapper;
import com.njbdqn.myshops.pojo.OrderItems;
import com.njbdqn.myshops.pojo.Orders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrdersService {
    @Autowired
    private OrdersMapper om;

    public void saveOrder(Orders order,List<OrderItems> ois) {
        om.saveOrder(order);
        for (OrderItems oi : ois) {
            oi.setOrd_id(order.getOrd_id());
        }
        om.saveOrderItems(ois);
    }
}
